Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ip

Package Overview
Dependencies
Maintainers
5
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ip

[![](https://badge.fury.io/js/ip.svg)](https://www.npmjs.com/package/ip)

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16M
increased by16.45%
Maintainers
5
Weekly downloads
 
Created

What is ip?

The 'ip' npm package is a utility module for IP address manipulation. It provides functions for various IP address-related operations such as formatting, parsing, subnetting, and CIDR manipulation.

What are ip's main functionalities?

IP address conversion and formatting

Converts IP addresses to buffer objects and back to string representation.

const ip = require('ip');
console.log(ip.toBuffer('127.0.0.1'));
console.log(ip.toString(ip.toBuffer('::1')));

Subnet information

Provides information about the subnet, such as network address, subnet mask, and broadcast address.

const ip = require('ip');
console.log(ip.subnet('192.168.1.134', '255.255.255.0'));

CIDR manipulation

Provides information about the CIDR range, including network address and subnet mask.

const ip = require('ip');
console.log(ip.cidrSubnet('192.168.1.134/26'));

IP address comparison

Compares IP addresses to check for equality and checks if an IP address is within a private range.

const ip = require('ip');
console.log(ip.isEqual('::1', '::0:1'));
console.log(ip.isPrivate('192.168.1.134'));

Other packages similar to ip

FAQs

Package last updated on 19 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc